<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<script>

    /*诊疗项目补全*/
    autoCompleteClinic("orderText");
    function autoCompleteClinic(inputId) {
        var url = "${ctx}/oper/clinicItemDict/automatic?itemClass=E,J,K";
        autoComplete(inputId, url,
                function (data) {
                    var rows = [];
                    for (var i = 0; i < data.length; i++) {
                        rows[rows.length] = {
                            data: data[i],
                            value: data[i].id,
                            result: data[i].itemName
                        };
                    }
                    return rows;
                }, function (data, i, max) {
                    return data.itemName + "|   " + data.itemCode + "|   " + data.price+"元";
                }, function (event, data, formatted) {
                    $("#clinicItemId").val(data.id);
                    $("#orderCode").val(data.itemCode);
                    $("#price").attr("value",data.price);
                    $("#sumPrice").attr("value",data.price);
                    $("#amount").attr("value",1);
                    $("#orderClass").attr("value",data.itemClass);
                })
    }
    $(function(){
        $("#btnCancel").on('click',function(){
            showDiv();
        })
        //改变总价
        $("#amount").change(function(){
            var num=$(this).val();
            var price=$("#price").val();
            $("#sumPrice").val(num*price);
        })
    })

    <%--function saveSub(id){--%>
        <%--hideSubDiv();--%>
        <%--return formSaveLoad('treatProjectItem','inputForm','${ctx}/treatProjectItem/treatProjectItem/save','${ctx}/treatProjectItem/treatProjectItem/indexTreat?id='+id);--%>

    <%--}--%>
//    $("#btnSubmit").on('click',function(){
//
//    })


</script>
<div class="content-wrap">
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="col-lg-12">
                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="treatProjectItem" method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="clinicItemId" />
                            <form:hidden path="orderClass"/>
                            <form:hidden path="newDept" value="${doctorTempla.billingDept}"/>
                            <form:hidden path="applyId" value="${treatProjectItem.applyId}"/>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">治疗类型：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="treatProjectId" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">医嘱类型：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="repeatIncaditor" htmlEscape="false" class="form-control"  maxlength="1" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">序号：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="itemNo" htmlEscape="false" class="form-control"  maxlength="11" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">医嘱类别：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="orderClass" htmlEscape="false" class="form-control"  maxlength="1" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">项目名称：</label>
                                    <div class="col-sm-8">
                                        <form:input path="orderText" data-parsley-required="true" htmlEscape="false" class="form-control"  maxlength="64" />
                                    </div>
                                </div>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">医嘱父级id：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">项目代码：</label>
                                    <div class="col-sm-8">
                                        <form:input path="orderCode" readonly="true" htmlEscape="false" class="form-control"  maxlength="64" />
                                    </div>
                                </div>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">计价属性：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="billingAttr" htmlEscape="false" class="form-control"  maxlength="1" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">数量：</label>
                                    <div class="col-sm-8">
                                        <form:input  type="number" min="0" data-parsley-required="true" path="amount" htmlEscape="false" class="form-control"  maxlength="11" />
                                    </div>
                                </div>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">单次剂量：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="singleDose" htmlEscape="false" class="form-control"  />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">计量单位：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="singleDoseUnit" htmlEscape="false" class="form-control"  maxlength="5" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">途径：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="administration" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">频次：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="performFreq" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>

                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">厂商：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="firmId" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">包装单位：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="drugUnits" htmlEscape="false" class="form-control"  maxlength="5" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">执行科室：</label>
                                    <div class="col-sm-8">
                                        <sys:treeselect isnull="true" id="performedBy"  name="performedBy"
                                                        value="${treatProjectItem.performedBy}"  update="false"
                                                        labelName="${treatProjectItem.performedBy}"
                                                        labelValue="${fns:getDeptName(treatProjectItem.performedBy,'')}"
                                                        title="科室" url="/sys/orgDept/treeData" extId="${orgDept.id}"
                                                        cssClass="form-control" selectedParent="true"/>

                                    </div>
                                </div>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">开单科室：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="newDept" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">护士执行时间：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="nursePerformTime" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">单价：</label>
                                    <div class="col-sm-8">
                                        <form:input path="price" htmlEscape="false" readonly="true" class="form-control"  />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-4 control-label">总价：</label>
                                    <div class="col-sm-8">
                                        <form:input path="sumPrice" htmlEscape="false" readonly="true" class="form-control"  />
                                    </div>
                                </div>
                            <div class="form-group">
                                <label class="col-sm-4 control-label">医生说明：</label>
                                <div class="col-sm-8">
                                    <form:input path="doctInstruction" htmlEscape="false" class="form-control"  maxlength="100" />
                                </div>
                            </div>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">是否皮试：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="isSkin" htmlEscape="false" class="form-control"  />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">机构id：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="orgId" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <%--<div class="form-group">--%>
                                    <%--<label class="col-sm-2 control-label">包装规格：</label>--%>
                                    <%--<div class="col-sm-4">--%>
                                        <%--<form:input path="packageSpec" htmlEscape="false" class="form-control"  maxlength="64" />--%>
                                    <%--</div>--%>
                                <%--</div>--%>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <input id="btnSubmit" onclick="saveSub('treatProjectItem','inputForm','${ctx}/treatProjectItem/treatProjectItem/save',
                                                '${ctx}/treatProjectItem/treatProjectItem/indexTreat?type=0&id=${treatProjectItem.applyId}','${treatProjectItem.applyId}')"
                                               class="btn btn-primary" type="button" value="保 存">&nbsp;
                                        <input id="btnCancel" class="btn" type="button" value="返 回">
                                </div>
                            </div>
                        </form:form>
                    </div>

                </div>
            </section>
    </div>